package il.ac.bgu.soa2009.hw6;

public class ClientPortTypeProxy implements il.ac.bgu.soa2009.hw6.ClientPortType {
  private String _endpoint = null;
  private il.ac.bgu.soa2009.hw6.ClientPortType clientPortType = null;
  
  public ClientPortTypeProxy() {
    _initClientPortTypeProxy();
  }
  
  public ClientPortTypeProxy(String endpoint) {
    _endpoint = endpoint;
    _initClientPortTypeProxy();
  }
  
  private void _initClientPortTypeProxy() {
    try {
      clientPortType = (new il.ac.bgu.soa2009.hw6.CinemaServiceServiceLocator()).getCinemaClientService();
      if (clientPortType != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)clientPortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)clientPortType)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (clientPortType != null)
      ((javax.xml.rpc.Stub)clientPortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public il.ac.bgu.soa2009.hw6.ClientPortType getClientPortType() {
    if (clientPortType == null)
      _initClientPortTypeProxy();
    return clientPortType;
  }
  
  public il.ac.bgu.soa2009.hw6.cinema.Movie[] getMovies() throws java.rmi.RemoteException{
    if (clientPortType == null)
      _initClientPortTypeProxy();
    return clientPortType.getMovies();
  }
  
  public il.ac.bgu.soa2009.hw6.cinema.Ticket orderTickets(il.ac.bgu.soa2009.hw6.cinema.TicketRequest ticketRequest) throws java.rmi.RemoteException{
    if (clientPortType == null)
      _initClientPortTypeProxy();
    return clientPortType.orderTickets(ticketRequest);
  }
  
  public void cancelTickets(il.ac.bgu.soa2009.hw6.cinema.TicketIdentifier ticketIdentifier) throws java.rmi.RemoteException{
    if (clientPortType == null)
      _initClientPortTypeProxy();
    clientPortType.cancelTickets(ticketIdentifier);
  }
  
  
}